package com.aspose.cells;

import java.util.ArrayList;

class zaus {
   zauk a;
   private int g;
   String b;
   private String h;
   byte[] c;
   zbrk d;
   int e = -1;
   zbro f;

   int a() {
      return this.g;
   }

   void a(int var1) {
      this.g = var1;
   }

   void a(int var1, String var2) {
      WorksheetCollection var3 = this.a.c.b;
      var3.a((Object)this);
      this.g = var1;
      if (var2 != null) {
         this.c = var3.x().a(-1, var2, 0, 0, 0, 64, false, false, false);
      }

      var3.a((Object)null);
      this.h = var2;
   }

   String a(int var1, int var2) {
      zauk var3 = this.a;
      zbqs var4 = (zbqs)var3.p.get(this.a());
      zbrk var5 = this.d;
      zbrf var6 = var5.a(var1);
      zbmb var7 = (zbmb)((zbmb)var4.c.get(var6.b().a(0).b & '\uffff'));
      Object var8 = var7.a;
      String var9 = "";
      if (var8 == null) {
         var9 = "(Blank)";
      } else {
         var9 = com.aspose.cells.b.a.zr.a(var8);
      }

      if (zyn.c(var9)) {
         var9 = '\'' + var9 + '\'';
      }

      if (var2 == 1) {
         String var10 = var4.a;
         if (zyn.c(var10)) {
            var10 = '\'' + var10 + '\'';
         }

         return var10 + "[" + var9 + "]";
      } else {
         return var9;
      }
   }

   void a(StringBuilder var1, int var2, boolean var3) {
      zauk var4 = this.a;
      zbqs var5 = (zbqs)var4.p.get(this.a());
      zbrk var6 = this.d;
      zbrf var7 = var6.a(var2);
      zbmb var8 = (zbmb)((zbmb)var5.c.get(var7.b().a(0).b & '\uffff'));
      String var9;
      if (var3) {
         var9 = var5.a;
         if (zaan.b(var9)) {
            var1.append('\'');
            var1.append(var9);
            var1.append('\'');
         } else {
            var1.append(var9);
         }

         var1.append('[');
      }

      var9 = "";
      if (var8.a == null) {
         var9 = "(Blank)";
      } else {
         var9 = com.aspose.cells.b.a.zr.a(var8.a);
      }

      if (zaan.b(var9)) {
         var1.append('\'');
         var1.append(var9);
         var1.append('\'');
      } else {
         var1.append(var9);
      }

      if (var3) {
         var1.append(']');
      }

   }

   int a(String var1) {
      String var2 = var1.toUpperCase();
      if (var2.charAt(var2.length() - 1) == ']') {
         int var3 = var2.lastIndexOf(91);
         if (var3 != -1) {
            var2 = var2.substring(var3 + 1, var3 + 1 + (var2.length() - 2 - var3));
         }
      }

      if (var2 != null && var2.charAt(0) == '\'') {
         var2 = var2.substring(1, 1 + (var2.length() - 2));
      }

      zauk var14 = this.a;
      zbrk var4 = this.d;
      int var5 = -1;
      zbqs var6 = (zbqs)var14.p.get(this.a());
      if (var6 != null) {
         ArrayList var7 = var6.c;

         for(int var8 = 0; var8 < var7.size(); ++var8) {
            String var9 = ((zbmb)var7.get(var8)).a != null ? com.aspose.cells.b.a.zr.a(((zbmb)var7.get(var8)).a).toUpperCase() : "(BLANK)";
            if (var9.equals(var2)) {
               for(int var10 = 0; var10 < var4.getCount(); ++var10) {
                  zbrf var11 = var4.a(var10);

                  for(int var12 = 0; var12 < var11.b().getCount(); ++var12) {
                     zbrg var13 = var11.b().a(var12);
                     if ((var13.b & '\uffff') == var8) {
                        var5 = var10;
                        break;
                     }
                  }

                  if (var5 != -1) {
                     break;
                  }
               }

               if (var5 == -1) {
                  var5 = var4.getCount();
                  var4.a(new zbrf(this.a(), var8));
               }
               break;
            }
         }
      }

      return var5;
   }

   public String b() {
      try {
         if (this.c == null) {
            return this.h;
         } else {
            WorksheetCollection var1 = this.a.c.b;
            var1.a((Object)this);
            String var2 = var1.b().a(0, this.c, 0, 0, false);
            var1.a((Object)null);
            return var2;
         }
      } catch (Exception var3) {
         return this.h;
      }
   }

   void b(String var1) {
      this.h = var1;
   }

   String c() {
      return this.h;
   }

   zaus(zauk var1, PivotField var2, String var3, String var4, int var5, int var6) {
      this.a = var1;
      this.d = new zbrk();
      this.g = var2.getBaseIndex();
      this.f = new zbro();
      this.f.a = (byte)var2.getPosition();
      zbqw var7 = new zbqw();
      com.aspose.cells.b.a.a.ze.a(this.f.e, (Object)var7);
      if (var5 == 2) {
         var7.a = 2;
      } else if (var5 == 1) {
         var7.a = 0;
      }

      var7.b = this.a() | 1024;
      var7.a((int)1);
      var7.c = new ArrayList();
      com.aspose.cells.b.a.a.ze.a(var7.c, (Object)var6);
      this.b = var3;
   }

   zaus(zauk var1) {
      this.a = var1;
      this.f = new zbro();
      this.d = new zbrk();
      zbqw var2 = new zbqw();
      com.aspose.cells.b.a.a.ze.a(this.f.e, (Object)var2);
      var2.b = this.a() | 1024;
      var2.a((int)1);
   }
}
